// pages/order/order-note/order-note.js
var httpUtil = require('../../../../utils/httpUtil.js');
var uiUtil = require('../../../../utils/uiUtil.js');
const app = getApp();
var that;

Page({

  /**
   * 页面的初始数据
   */
  data: {
    noteText:null,
    maxNumber:200,
    number:0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    that = this;
    let noteText = options.noteText;
    if (noteText != "null" && noteText != ""){
      that.setData({
        noteText: noteText
      })
    }
  },

  /**
   * 输入字数
   */
  textChange(e){
    let number = e.detail.value.length;
    that.setData({
      number: number
    })
  },

  /**
   * 保存收货地址
   */
  submitForm(res) {
    let noteText = res.detail.value.noteText;
    var pages = getCurrentPages();
    var lastPage = pages[pages.length - 2];
    if (lastPage.route == "pages/index/order/order-pre/order-pre") {
      lastPage.setData({
        "value.noteText": noteText
      })
      wx.navigateBack({
        delta: 1,
      });
    }
  },
})